All Questions
21 questions
12votes
3answers
2kviews
Matrix implementation
I am trying to implement an optimal and fast running matrix in C++. I need some review of the code and ideas on how to improve the code quality if it shall be. ...
5votes
2answers
439views
Python's enumerate for C++
I implemented an enumerate() method for C++ containers similar to Python's enumerate to iterate through a range with an index and the actual value. I have the following questions: Does the usage of ...
3votes
1answer
180views
Image (Const) Iterator using C++17
I am trying to learn how to correctly implement an iterator (and its corresponding const variant) using a single template, so I would appreciate any criticism to the following code. It's an forward ...
5votes
1answer
627views
`zip` operator to iterate on multiple container in a sign
I worked out a zip operator similar to Python's, because I didn't find one in std. It allows to use range-based ...
2votes
1answer
140views
template iterable numeric range class with multiple min/max inclusion modes
Problem my code solves: Lack of lightweight numeric range classes which can tell if arbitrary values lie inside them, supporting more than just simple exclusive max modes and integers, and that ...
10votes
2answers
12kviews
C++17 zip iterator compatible with std::sort
Here are ~100 lines of code implementing three classes (ZipRef, ZipIter, Zip) which should ...
10votes
2answers
2kviews
Iterator for traversing a tree [v2]
this is an update of the implementation after I followed the feedback from Iterator for traversing a tree. After that I did changed quite a bit on the design and decided to ask for another round of ...
3votes
1answer
351views
Iterator for traversing a tree
What I want to achieve is the following: ...
9votes
1answer
230views
General algorithm to calculate sums of all subsets of a given sequence of numbers
Background A recent question Print sums of all subsets made its way to the Hot Network Questions list. The problem is simple: Print sums of all subsets of a given set Given an array of ...
4votes
3answers
732views
My implementation of a for_each function that traverses a std::container by some step size integer N
As my answer to Iterating over an odd (even) elements only in a range-based loop, I wrote this function, with the following driver program and output: ...
2votes
1answer
92views
Iterating over different Objects which are ordered by index number
I am currently working on a bigger project where I found a part of it which seems very ugly to me from the code. I stripped out the algorithm and made a working code, so it can be reviewed. I have a ...
2votes
1answer
68views
Class representing digital PLC address
I have a project where I work with digital addresses for a Programmable Logic Controller (PLC). The requirement is that the user gives a start address e.g. 1000.0 and then for example the next 20 ...
4votes
1answer
1kviews
back_inserter for several container arguments
Recently I wrote a back_inserter with the same interface as the std::back_inserter just for supporting several containers in the constructor and doing push_back for each. The solution needs C++17. ...
5votes
2answers
117views
Iterable object on set of ids
For some of the algorithms that I am implementing it turned out to be useful storing ids in order to iterate on objects, while also avoiding having to think about reallocation and invalidation of ...
7votes
2answers
2kviews
Generic in order traversal iterator for binary trees
This actually started off as member type for the binary_search_tree, but after realizing that it doesn't compare to values or use the value objects inside of it, I ...